import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '商家对应账号ID',
    align: "center",
    dataIndex: 'merchantId'
  },
  {
    title: '充值金额',
    align: "center",
    dataIndex: 'amount'
  },
  {
    title: '备注',
    align: "center",
    dataIndex: 'remark'
  },
  {
    title: '创建时间',
    align: "center",
    dataIndex: 'createTime'
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "商家对应账号ID",
    field: 'merchantId',
    component: 'JSearchSelect',
    componentProps: {
      dict: "sys_user where user_type = 2,realname,id"
    },
    //colProps: {span: 6},
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '商家对应账号ID',
    field: 'merchantId',
    component: 'JSearchSelect',
    componentProps: {
      dict: "sys_user,realname,id"
    },
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入商家对应账号ID!' },
      ];
    },
  },
  {
    label: '充值金额',
    field: 'amount',
    component: 'InputNumber',
  },
  {
    label: '备注 注释',
    field: 'remark',
    component: 'Input',
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
];

// 高级查询数据
export const superQuerySchema = {
  merchantId: { title: '商家对应账号ID', order: 0, view: 'sel_search', type: 'string', dictTable: "sys_user", dictCode: 'id', dictText: 'realname', },
  amount: { title: '充值金额', order: 1, view: 'number', type: 'number', },
  remark: { title: '备注 注释', order: 2, view: 'text', type: 'string', },
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}